<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/mytag.jspf"%>%>

<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>">
<title>user</title>
<script type="text/javascript">
	$("#grid").jqGrid({
		pager:"#pager",
		url:"management/vip/payFlowpage",
	   	colNames:["流水号","会员卡号","姓名","性别","充值金额","充值时间"],
	   	colModel:[
	   		{name:"flowNo",width:100,hidden:true},
	   		{name:"vipNo", width:50},
	   		{name:"vipName",width:80},
	   		{name:"sex",width:20,formatter: "select", editoptions:{value:"M:男;F:女"}},
	   		{name:"amount",width:50},
	   		{name:"completeTime",width:50}
	   	]
	});
	function getmoney(){
		var url = "management/vip/getpayFlowAmount";
		$.ajax({
			type : 'POST',
			url : url,
			data:$("#queryForm").serializeJson(), //发送数据
			dataType : 'json',
			success : function(data) {
				if (data.success) {
					$("#countId").text("汇总金额："+data.msg);	//插入汇总金额
				}
			}
		});
	}

	$(function(){ 
		var firstDate = new Date();
		firstDate.setDate(1); //第一天
		var endDate = new Date(firstDate);
		endDate.setMonth(firstDate.getMonth()+1);
		endDate.setDate(0);
		var begdata = firstDate.getFullYear()+"-"+(firstDate.getMonth()<9?("0"+firstDate.getMonth()):(firstDate.getMonth()+1))+"-"+
				(firstDate.getDate()<10?("0"+firstDate.getDate()):firstDate.getDate());
		var enddata = endDate.getFullYear()+"-"+(endDate.getMonth()<9?("0"+endDate.getMonth()):(endDate.getMonth()+1))+"-"+
				(endDate.getDate()<10?("0"+endDate.getDate()):endDate.getDate());
		$("#begDate").val(begdata);
		$("#endDate").val(enddata);
		getmoney();
	    $("#searchBtn").click(function(){
	    	 getmoney();
	        $("#grid").jqGrid('setGridParam',{ 
	            postData:$("#queryForm").serializeJson(), //发送数据
	            page:1
	        }).trigger("reloadGrid"); //重新载入 
	    }); 
	});
</script>
</head>

<body>
	<ol class="am-breadcrumb am-breadcrumb-slash am-padding" style="margin-bottom: 0px;">
		<li><a href="management/index">首页</a></li>
		<li class="am-active">会员充值查询</li>
	</ol>	
	<div class="am-g">
		   <div class="am-u-md-12">
			<form id="queryForm" class="am-form-inline" role="form">
			  <div class="am-form-group">
					<select id="payWay" name="payWay" class="am-form-field" >
						<option value="XJ">线下充值</option>
						<option value="ZX">在线充值</option>
					</select>
			  </div>
			  <div class="am-form-group">
			    <input class="am-form-field" type="text" name="begDate" id="begDate"   placeholder="请输选择起始日期"  data-am-datepicker readonly>
			  </div>
			  
			  <div class="am-form-group">
			    <input class="am-form-field" type="text" name="endDate" id="endDate"  placeholder="请输选择截止日期"  data-am-datepicker readonly>
			  </div>
			  <div class="am-form-group">
			  	<input class="am-form-field" type="text" id="vipNo" name="vipNo" placeholder="请输入会员号查询" >
			  </div>
			  <button id ="searchBtn"  type="button" class="am-btn am-btn-default">搜索</button>
			  <label id="error" style="color: red;"></label>
			 </form>
		   </div>
	</div>
	<div class="am-g am-padding-vertical">
		<div class="am-u-md-12">
			<table id="grid"></table>
			<div id="pager"></div>
			<div id="countId"></div>
		</div>
	</div>
</body>
</html>
